improvement(tool-input): general abstraction to enrich agent context, reuse visibility helpers#2872
Merged
icecrasher321 merged 6 commits intostagingfrom Jan 18, 2026
Merged
Conversation
…nce for tags, fix visibility of subblocks
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR introduces a general abstraction for enriching agent context with runtime-dependent schema information, with the primary use case being Knowledge Base tags. The implementation consolidates visibility helpers and improves parameter handling across the codebase. Key Changes:
Issues Found:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as Tool Input UI
participant Store as Block Store
participant Params as params.ts
participant Enricher as schema-enrichers.ts
participant API as Tag Definitions API
participant Handler as Agent Handler
participant Provider as Provider Utils
participant Tool as Tool Execution
Note over UI,Store: User configures KB ID
UI->>Store: Set knowledgeBaseId
Note over UI,Params: Build preview context
UI->>Params: buildPreviewContextValues()
Params-->>UI: Resolved canonical values
Note over UI,API: Fetch tag definitions for UI
UI->>API: GET /api/knowledge/{id}/tag-definitions
API-->>UI: Tag definitions array
UI->>UI: Render document-tag-entry/tag-filters
Note over Handler,Tool: Agent executes tool with params
Handler->>Provider: prepareToolExecution(tool, llmArgs)
Provider->>Params: mergeToolParameters(userParams, llmArgs)
Params-->>Provider: Merged tool params
Note over Provider,Tool: Create LLM tool schema
Provider->>Params: createLLMToolSchema(toolConfig, userParams)
Params->>Params: Check schemaEnrichment config
alt documentTags/tagFilters has enrichment
Params->>Enricher: enrichKBTagsSchema(knowledgeBaseId)
Enricher->>API: GET /api/knowledge/{id}/tag-definitions
API-->>Enricher: Tag definitions
Enricher-->>Params: Dynamic schema with KB tags
Params-->>Provider: LLM schema with enriched params
end
Provider->>Tool: Execute with merged params + enriched schema
Note over Tool,Params: Parse and normalize tags
Tool->>Params: parseDocumentTags(value)
Params-->>Tool: Normalized tag entries
Tool->>Params: formatDocumentTagsForAPI(tags)
Params-->>Tool: documentTagsData JSON
Tool-->>Handler: Tool execution result
|
Collaborator
Author
|
@greptile |
Collaborator
Author
|
@greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Type of Change
Testing
Tested manually
Checklist